﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
 	<%@ include file="/WEB-INF/view/jQgrid.jsp"%>
</head>
<body>
<div class="container-fluid" id="main-container">
    <div id="page-content" class="clearfix">
        <div class="row-fluid">
            <div class="row-fluid">
                <!-- 检索  -->
                <%-- <div class="ibox-title" style="border-color: white;">
                    <div class="row">
		                 <div class="col-sm-12">
							<div class="form-group form-inline">
								<span> 姓名：</span>
								<input id="name" type="text" placeholder="请输入姓名" class="input-sm form-control">
								<span> 岗位名称：</span>
								<input id="position" type="text" placeholder="请输入岗位名称" class="input-sm form-control">
								<span> 行业名称：</span>
								<input type="text" class="form-control" id="industryName"
										onclick="openTree('industry');" placeholder="请选择行业"
										readonly="readonly"  name="industryNames"/> <input type="hidden" name="industryId"
										id="industryId" />
								<span> 期望工作城市：</span>
								<input type="text" class="form-control" id="areaName"
										onclick="openTree('area');" placeholder="请选择区域"
										readonly="readonly"  name="expectedCityNames"/>
										<input type="hidden" name="expectedCity" id="areaId" />
							</div>
						</div>
						<div class="col-sm-12">
							<div class="form-group form-inline">
							<span> 手机号码：</span>
								<input id="phone" type="text" placeholder="请输入手机号码" class="input-sm form-control" onblur="isPhone('phone',this.value)">
							<span> 创建人：</span>
							<select id="createUserId" class="form-control">
								<option value="">==请选择==</option>
								<c:forEach var="user"  items="${users }">
								<option value="${user.id }">${user.dep.depName} -/- ${user.truename }</option>
								</c:forEach>
							</select>
							<span>起止时间：</span>
							<input id="startDate" type="text" placeholder="请输入开始时间" class="input-sm form-control form_datetime" readonly="readonly">—
							<input id="endDate" type="text" placeholder="请输入结束时间" class="input-sm form-control form_datetime" readonly="readonly">
								<a id="find_btn" type="button"
												class="btn btn-sm btn-primary"> 搜索</a>&nbsp;&nbsp;
								<a id="reset_btn" type="button"
												class="btn btn-sm btn-warning"> 重置</a>&nbsp;&nbsp;
								<s:hasPermission name="talentsResumeResource:add">
									 <a id="add_btn" type="button" class="J_menuItem btn btn-sm btn-success"
												href="<%=contextPath%>/talentsResumeResource/addView">新增</a>
									</s:hasPermission>
							</div>
						</div>
                    </div>
                </div> --%>
                <!-- biaogebigin -->
                <div class="ibox-content" style=" padding-left: 0px; margin-top: 10px;">
                    <div class="jqGrid_wrapper">
                        <table id="table_list"></table>
                        <div id="pager_list"></div>
                    </div>
                </div>
                <!-- tableover -->
            </div>
            <!-- PAGE CONTENT ENDS HERE -->

        </div>
        <!--/row-->
    </div>
    <!--/#page-content-->
</div>
<!--/.fluid-container#main-container-->
<script type="text/javascript">
$(".form_datetime").datetimepicker({
	  minView: "month",//设置只显示到月份
	  format : "yyyy-mm-dd",//日期格式
	  autoclose:true,//选中关闭
	  todayBtn: true,//今日按钮
      language:  'zh-CN',
});
    $(top.hangge());
        $.jgrid.defaults.styleUI = "Bootstrap";
        $("#table_list").jqGrid({
            url: '<%=contextPath%>/talentsResumeResource/listData',
            datatype: "json",
            postData: {}, //发送数据
            autowidth: true,
            rownumbers: true,
            shrinkToFit: true,
            sortname: 'createDate',
            sortorder: "desc",
            mtype: "post",
            rowNum: 10,
            rowList: [10, 20, 30],
            colNames: ["id","姓名","性别","年龄","学历","手机",/* "类型", */"行业","目前岗位",/* "国籍", */"目前薪酬","期望工作城市","状态",/* "采纳人","采纳时间", */ "操作"],
            colModel: [{
                name: "id",
                index: "id",
                hidden: true
            }, {
                name: "trueName",
                index: "trueName",
                width: 50,
                frozen : true
            }, {
                name: "sex",
                index: "sex",
                width: 50,
                formatter: function (value, options, row) {
                	if(value ==1){
                		return "男";
                	}
                	if(value ==2){
                		return "女";
                	}
                }
            }, {
                name: "age",
                index: "age",
                width: 50,
                frozen : true
            }, {
                name: "education",
                index: "education",
                width: 60,
                frozen : true
            }, {
                name: "phoneview",
                index: "phoneview",
                width: 90,
                frozen : true
            }/* , {
                name: "dictType",
                index: "dictType",
                width: 100
            } */, {
                name: "industryNames",
                index: "industryNames",
                width: 100
            }, {
                name: "position",
                index: "position",
                width: 100
            }, /* {
                name: "nationality",
                index: "nationality",
                width: 50
            }, */ {
                name: "emolument",
                index: "emolument",
                width: 80,
                formatter: function (value, options, row) {
                	return "￥"+value+"万"
                }
            }, {
                name: "expectedCityNames",
                index: "expectedCityNames",
                width: 100
            }, {
                name: "isAdopt",
                index: "isAdopt",
                width: 80,
                formatter: function (value, options, row) {
                	if(value ==0){
                		return "<font style='color:red'>未采纳<font>";
                	}
                	if(value ==1){
                		return "<font>已采纳</font>";
                	}
                }
            }, {
                formatter: function (cellvalue, options, row) {
                    return "   <s:hasPermission name="talentsResumeResource:detail"><a class='btn btn-sm btn-success' title='查看' onclick='showdetail(&quot;" + row.id + "&quot;)'><i class='icon-eye-open'></i></a></s:hasPermission> "     
                               + "<s:hasPermission name="talentsResumeResource:edit"><a class='btn btn-sm btn-info' title='采纳' onclick='showedit(&quot;" + row.id + "&quot;)'><i class='icon-edit'></i></a></s:hasPermission> "
                               + " <s:hasPermission name="talentsResumeResource:delete"><a class='btn btn-sm btn-danger' title='删除' onclick='del(&quot;" + row.id + "&quot;)'><i class='icon-trash'></i></a></s:hasPermission> ";
                },
                width: 165
            }],
            height: $(window).height() - 170,
            pager: "#pager_list",
            multiselect: true,//多选按钮
            //multiboxonly: true,
            viewrecords: true,
            hidegrid: false
        });
        //表格自适应高宽
        $(window).bind("resize", function () {
            var b = $(".jqGrid_wrapper").width();
            $("#table_list").setGridWidth(b);
            $("#table_list").setGridHeight($(window).height() - 170);
        })
        $("#table_list").navGrid('#pager_list', {edit: false, add: false, del: false, search: false})
        /* 判断是否有添加权限 */
        //检索
        $("#find_btn").click(function () {
        	//姓名
            var name = $("#name").val();
            //岗位
        	var position = $("#position").val();
            //行业
            var industryId = $("#industryId").val();
            //期望工作城市
            var areaId = $("#areaId").val();
            //手机号码
            var phone = $('#phone').val();
          //创建人
            var createUserId = $('#createUserId').val();
          //开始时间
            var startDate = $('#startDate').val();
          //结束时间
            var endDate = $('#endDate').val();
            $("#table_list").jqGrid('setGridParam', {
                postData: {
                	'name': name,
                	'position':position,
                	'industryId':industryId,
                	'expectedCity':areaId,
                	'phone':phone,
                	'createuserid':createUserId,
                	'startDate':startDate,
                	'endDate':endDate
                	}, //发送数据
                page: 1
            }).trigger("reloadGrid"); //重新载入
        });
        $("#reset_btn").click(function(){ 
			$('#name').val('');
			$('#position').val('');
			$('#industryId').val(''); 
			$('#industryName').val(''); 
			$('#areaId').val(''); 
			$('#areaName').val(''); 
			$('#phone').val('');
			$('#createUserId').val('');
			$('#startDate').val('');
			$('#endDate').val('');
		});

    //删除
    function del(id) {
        swalopen(id, "<%=contextPath%>/talentsResumeResource/delete");
    };

    //修改
    function showedit(id) {
    	window.location.href = "<%=contextPath%>/talentsResumeResource/editView?id=" + id;
    }
    //修改
    function showdetail(id) {
        openyem("查看简历", "<%=contextPath%>/talentsResumeResource/detailView?id=" + id, 1000, 1080);
    }

    //沟通记录
    function addchat(id) {
    	openyem("添加沟通记录", "<%=contextPath%>/demandCommunicate/addView?talentsId=" + id, 500, 550);
    }
    function openTree(obj,num){
	     var ids = $("#"+obj+"Id").val();
	   	 var diag = new top.Dialog();
		 diag.Drag=true;
		 diag.Title ="请选择";
		 diag.URL = '<%=contextPath %>/'+obj+'/openZtree?ids='+ids;
		 diag.Width = 250;
		 diag.Height = 400;
		 diag.CancelEvent = function(){ //关闭事件
			 var tempid = diag.innerFrame.contentWindow.document.getElementById('tempids').value;
			 var tempname = diag.innerFrame.contentWindow.document.getElementById('tempnames').value;
			if(tempid.length!==0){
				if(typeof(num)=="undefined"){ 
					$("#"+obj+"Id").val(tempid);
					$("#"+obj+"Name").val(tempname);
				}else{
					$("#"+obj+num+"Id").val(tempid);
					$("#"+obj+num+"Name").val(tempname);
				}
			}
			diag.close();
		 };
		 diag.show();
	}
</script>
</body>
</html>

